package com.axjy.controller;
import com.axjy.pojo.User;
import com.axjy.util.Log;
import com.axjy.vo.Pager;
import com.axjy.service.UserService;
import com.axjy.vo.UserDto;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/sys/user")
public class UserController {

    private String msg;

    @Resource
    private UserService userService;




    @GetMapping("/pager")
    public Pager searchPager(UserDto dto){
      return  userService.searchPager(dto);
    }

    @PostMapping("/grant")
    public String grant(Integer uid,Integer rid){
        try {
            userService.grant(uid,rid);
            msg="用户授权成功！";
        }catch (Exception ex){
            msg="用户授权失败！";
            Log.LOGGER.error(msg,ex);
        }
        return msg;
    }


}
